﻿namespace hr_1.Model
{
    public class PersonalDoc
    {
        HRDataContext hrData = new HRDataContext();
        public int PersonalDocId { get; set; }
        public string PasspSeries { get; set; }
        public string PasspNumber { get; set; }
        public string PasspWho { get; set; }
        public string PasspWhen { get; set; }
        public string BirthPlace { get; set; }
        public string MedPolicy { get; set; }
        public string Inn { get; set; }
        public string Snils { get; set; }

        public PersonalDoc() { }

        public void Save()
        {
            personal_doc NewPersonalDoc = new personal_doc
            {
                passp_series = PasspSeries,
                passp_number = PasspNumber,
                passp_who = PasspWho,
                passp_when = PasspWhen,
                birthplace = BirthPlace,
                med_policy = MedPolicy,
                inn = Inn,
                snils = Snils
            };
            hrData.personal_docs.InsertOnSubmit(NewPersonalDoc);
            hrData.SubmitChanges();
            PersonalDocId = NewPersonalDoc.personal_docId;
        }
    }
}
